import warnings
warnings.filterwarnings('ignore')

# 自行引发警告
warnings.warn('hasaki warning')
>>>
UserWarning: hasaki warning